<?php
/**
 * $Id: default.php 11 2010-05-18 11:39:11Z webbochsant $
 *  @package	Joomla
 *  @author Daniel Eliasson
* 	@copyright	Copyright (C) 2010 Stilero. All rights reserved.
* 	@license	GNU/GPL, see LICENSE.php
* 	Joomla! is free software. This version may have been modified pursuant
* 	to the GNU General Public License, and as distributed it includes or
* 	is derivative of works licensed under the GNU General Public License or
* 	other free or open source software licenses.
*/

// no direct access
defined('_JEXEC') or die('Restricted access'); 


global $mosConfig_live_site, $mosConfig_absolute_path;

?>

<?php //JHTML::_('stylesheet', 'competitiondefault.css', 'components/com_vmcompetition/assets/'); ?>

<?php if ($this->params->get( 'show_page_title', 1)) : ?>
<div class="componentheading<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
	<?php echo $this->escape($this->params->get('page_title')); ?>
</div>
<?php endif; ?>

<div class="contentpane<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
<?php if($this->competitions->id){

?>

<img class="prizeimage" src="<?php echo JRoute::_("components/com_virtuemart/shop_image/product/".$this->competitions->prodimage);?>" alt="<?php print JText::_($this->competitions->prodname); ?>"/>
<?php print $this->competitions->description ?>
<?php 
		$cookieName	= JUtility::getHash( $mainframe->getName() . 'compete' . $this->competitions->id );
		// ToDo - may be adding those information to the session?
		$competed = JRequest::getVar( $cookieName, '0', 'COOKIE', 'INT');

		if (!$competed)
		{
?>
<?php 		echo $this->loadTemplate('form');?>
<?php 	} else{
			print "<p>".JText::_('Already competed, please check back later.')."</p>";
		}
	}else{
	print "<p>".JText::_('No active competitions, please check back later.')."</p>";
	}?>
	
<?php echo $this->loadTemplate('winners'); ?>
</div>